Identification of spam in email messages received over a communications'network becomes an extremely pressing problem with ever increasing popularity of unsolicited email-based product and service advertising. There are many different technical solutions for identifying spam in the ordinary text messages, but the task of identifying spam is much more difficult in the case of text spam embedded in an image as well as spam images, such as images of unsolicited products, services, etc. Identification of image-based spam is difficult because spam detection system must first identify the text in the image and then determine whether this text can be classified as spam. In case there is no text in the image, the detection system must identify the image itself as spam. Known approaches for identify spam in images have a number of shortcomings, such as slow execution attributed to the complexity of the algorithm and to a large number of errors during detection of spam. Accordingly, there is a need for a more efficient and effective mechanism for detection of spam in images.